You can combine mechanisms and electromechanical parts (e.g., Motor, Solenoid and Microswitch) to make mechanical systems.
See Changing views of Mechanism parts and Gear and Flywheel for details on creating mechanical systems.